package com.tiantian.subject.dubbo;

import com.tiantian.api.RemoteSubjectService;
import com.tiantian.api.domain.vo.RemoteSubjectVo;
import com.tiantian.subject.mapper.TopicTagMapper;
import com.tiantian.subject.service.SubjectService;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author tiantian
 */
@Service
@DubboService
@RequiredArgsConstructor
public class RemoteSubjectServiceImpl implements RemoteSubjectService {

    private final SubjectService subjectService;
    private final TopicTagMapper topicTagMapper;

    @Override
    public int getSubjectTotal() {
        return subjectService.getSubjectTotal();
    }

    @Override
    public RemoteSubjectVo getSubjectById(String topicId) {
        List<String> list = topicTagMapper.selectByTopicId(topicId);
        RemoteSubjectVo remoteSubjectVo = new RemoteSubjectVo();
        remoteSubjectVo.setTags(list);
        return remoteSubjectVo;
    }

}
